package com.study.util;

import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

public class DateTimeUtil {
    public static String getNowString() {
        return DateTime.now().toString("yyyy-MM-dd HH:mm");
    }

    public static Integer daysBetweenNow(String createTime) {
        DateTime now = DateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
        DateTime createDate = DateTime.parse(createTime, dateTimeFormatter);
        return Days.daysBetween(createDate, now).getDays()+1;
    }
}
